/*
 * All IO should take place in the main class.
 */
package monopolygame;

import java.util.Scanner;

public class MonopolyGame {
    
    private Game game;
    
    MonopolyGame() {
        int nrOfPlayers = getNrOfPlayers();
        game = new Game(nrOfPlayers);
        setPlayers(nrOfPlayers);
    }
    
    private int getNrOfPlayers() {
        System.out.println("How many people will play Monopoly today?");
        Scanner s = new Scanner(System.in);
        int nrOfPlayers;
        do {
            nrOfPlayers = s.nextInt();
            if(nrOfPlayers > Game.MAX_NR_PLAYERS || nrOfPlayers <= 0)
                System.out.println("The game requires between 1 and " + Game.MAX_NR_PLAYERS + " players.");
        } while(nrOfPlayers > Game.MAX_NR_PLAYERS || nrOfPlayers <= 0);
        return nrOfPlayers;
    }
    
    private void setPlayers(int nrOfPlayers) {
        Scanner s = new Scanner(System.in);
        
        for(int i=0; i<nrOfPlayers; i++) {
            System.out.println("Please enter the name for player " + (i+1) + ":");
            String name = s.next();
            int id = i;
            int money = Game.MONEY_START_AMOUNT;
            game.addPlayer(new Player(id, money, name));
        }
    }
    
    public static void main(String[] args) {
        new MonopolyGame().start();
    }
    
    private void start() {
        
    }
}
